<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active{
      color: red;
    }
  </style>
</head>
<body>
  <div id="app">
 
    <ul>
      <li v-for="(item,index) in books" 
      :class="{active: currentIndex===index}"
      @click="btnColor(index)"> {{item}} {{index}}
    </li>
    </ul>
  
  </div>

  <script src="../js/vue.js"></script>
  <script>
    let app = new Vue({
      el: '#app',  //先定义抓取id
      data: {
        books:["ji","jkl","uzi"],
        currentIndex:0,
      },

      methods: {
      btnColor(index){
        this.currentIndex=index;
      }
      }
    })
  </script>
</body>
</html>